function tokens(val) {
    return window.btoa(val)
}

const login = {
    url: '/geek-admin/user/login',
    type: 'post',
    response: config => {
        const { username } = config.body

        // mock error
        if (username !== 'justorez') {
            return {
                code: 60204,
                message: 'Account and password are incorrect.'
            }
        }

        const token = tokens[username]
        return {
            code: 20000,
            data: token
        }
    }
}

export {
    login
}